package com.example.leetcode.bfs;

import com.example.leetcode.bfs.common.BFSUtils;
import com.example.leetcode.tree.common.TreeNode;
import com.example.leetcode.tree.common.TreeUtils;

/**
 * Definition for a binary tree node.
 * public class TreeNode {
 * int val;
 * TreeNode left;
 * TreeNode right;
 * TreeNode() {}
 * TreeNode(int val) { this.val = val; }
 * TreeNode(int val, TreeNode left, TreeNode right) {
 * this.val = val;
 * this.left = left;
 * this.right = right;
 * }
 * }
 */
class Solution965 {
    public boolean isUnivalTree(TreeNode root) {
        return BFSUtils.isUnivalTree(root);
    }
}

public class leetcode965 {
    public static void main(String[] args) {
        Solution965 solution965 = new Solution965();
        Integer[] nums = {1, 1, 1, 1, 1, null, 1};
        Integer[] nums1 = {2, 2, 2, 5, 2};
        System.out.println(solution965.isUnivalTree(TreeUtils.generateLeetcodeTree(nums)));
        System.out.println(solution965.isUnivalTree(TreeUtils.generateLeetcodeTree(nums1)));
    }
}
